package entity;

import java.io.Serializable;
//import java.sql.Date;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

@Entity
public class StakeholderEntity implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private String username; 
    private String password; 
    private String stakeholderName; 
    private String corpName; 
    private String bizRegNumber; 
    private String billingAddress;
    
    
    private String corpContactNumber;
    private String corpContactPerson;
    private String corpEmail;
    private String corpFaxNumber; 
    private Boolean activate = false;
    
    //team 32 attributes for billing
    private int billingDay;
    
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date loginTime; 
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date loginOutTime; 
    
    //for stakeholder portal
    private String imgURL;
    private String stakeholderDesc;
    
    @OneToOne
    private IndustryTypeEntity industryType;
    
    @OneToOne
    private AddressEntity address;
    
    
    @OneToMany(cascade = {CascadeType.ALL}, mappedBy = "stakeholder")
    private List<BranchEntity> branch = new ArrayList<BranchEntity>();
    
    // private List<PaymentManagementEntity> paymentManagement = new ArrayList<PaymentManagementEntity>();
    //@OneToMany(mappedBy = "stakeholder")
    
    public StakeholderEntity() {
    }
    
     public StakeholderEntity(StakeholderEntity stakeholder) {
        this.username = stakeholder.getUsername();
        this.password = stakeholder.getPassword();
        this.corpName = stakeholder.getCorpName();
        this.corpContactNumber = stakeholder.getCorpContactNumber();
        this.corpContactPerson = stakeholder.getCorpContactPerson();
        this.corpEmail = stakeholder.getCorpEmail();
        this.corpFaxNumber = stakeholder.getCorpFaxNumber();   
        this.bizRegNumber = stakeholder.getBizRegNumber();
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (getStakeholderId() != null ? getStakeholderId().hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StakeholderEntity)) {
            return false;
        }
        StakeholderEntity other = (StakeholderEntity) object;
        if ((this.getStakeholderId() == null && other.getStakeholderId() != null) || (this.getStakeholderId() != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Stakeholder[ id=" + getStakeholderId() + " ]";
    }

    public Long getStakeholderId() {
        return id;
    }

    public void setStakeholderId(Long id) {
        this.id = id;
    }

    public String getStakeholderDesc() {
        return stakeholderDesc;
    }

    public void setStakeholderDesc(String stakeholderDesc) {
        this.stakeholderDesc = stakeholderDesc;
    }

    /**
     * @return the imgURL
     */
    public String getImgURL() {
        return imgURL;
    }

    /**
     * @param imgURL the imgURL to set
     */
    public void setImgURL(String imgURL) {
        this.imgURL = imgURL;
    }

    /**
     * @return the stakeholderName
     */
    public String getStakeholderName() {
        return stakeholderName;
    }

    /**
     * @return the corpName
     */
    public String getCorpName() {
        return corpName;
    }

    /**
     * @return the bizRegNumber
     */
    public String getBizRegNumber() {
        return bizRegNumber;
    }

    /**
     * @return the billingAddress
     */
    public String getBillingAddress() {
        return billingAddress;
    }

    /**
     * @return the corpContactNumber
     */
    public String getCorpContactNumber() {
        return corpContactNumber;
    }

    /**
     * @return the corpContactPerson
     */
    public String getCorpContactPerson() {
        return corpContactPerson;
    }

    /**
     * @return the corpEmail
     */
    public String getCorpEmail() {
        return corpEmail;
    }

    /**
     * @return the corpFaxNumber
     */
    public String getCorpFaxNumber() {
        return corpFaxNumber;
    }

   
    /**
     * @param stakeholderName the stakeholderName to set
     */
    public void setStakeholderName(String stakeholderName) {
        this.stakeholderName = stakeholderName;
    }

    /**
     * @param corpName the corpName to set
     */
    public void setCorpName(String corpName) {
        this.corpName = corpName;
    }

    /**
     * @param bizRegNumber the bizRegNumber to set
     */
    public void setBizRegNumber(String bizRegNumber) {
        this.bizRegNumber = bizRegNumber;
    }

    /**
     * @param billingAddress the billingAddress to set
     */
    public void setBillingAddress(String billingAddress) {
        this.billingAddress = billingAddress;
    }

    /**
     * @param corpContactNumber the corpContactNumber to set
     */
    public void setCorpContactNumber(String corpContactNumber) {
        this.corpContactNumber = corpContactNumber;
    }

    /**
     * @param corpContactPerson the corpContactPerson to set
     */
    public void setCorpContactPerson(String corpContactPerson) {
        this.corpContactPerson = corpContactPerson;
    }

    /**
     * @param corpEmail the corpEmail to set
     */
    public void setCorpEmail(String corpEmail) {
        this.corpEmail = corpEmail;
    }

    /**
     * @param corpFaxNumber the corpFaxNumber to set
     */
    public void setCorpFaxNumber(String corpFaxNumber) {
        this.corpFaxNumber = corpFaxNumber;
    }

    /**
     * @return the loginTime
     */
    public Date getLoginTime() {
        return loginTime;
    }

    /**
     * @return the loginOutTime
     */
    public Date getLoginOutTime() {
        return loginOutTime;
    }

    /**
     * @param loginTime the loginTime to set
     */
    public void setLoginTime(Date loginTime) {
        this.loginTime = loginTime;
    }

    /**
     * @param loginOutTime the loginOutTime to set
     */
    public void setLoginOutTime(Date loginOutTime) {
        this.loginOutTime = loginOutTime;
    }

    /**
     * @return the activate
     */
    public Boolean getActivate() {
        return activate;
    }

    /**
     * @return the billingDay
     */
    public int getBillingDay() {
        return billingDay;
    }

    /**
     * @param activate the activate to set
     */
    public void setActivate(Boolean activate) {
        this.activate = activate;
    }

    /**
     * @param billingDay the billingDay to set
     */
    public void setBillingDay(int billingDay) {
        this.billingDay = billingDay;
    }

    /**
     * @return the industryType
     */
    public IndustryTypeEntity getIndustryType() {
        return industryType;
    }

    /**
     * @param industryType the industryType to set
     */
    public void setIndustryType(IndustryTypeEntity industryType) {
        this.industryType = industryType;
    }

    /**
     * @return the address
     */
    public AddressEntity getAddress() {
        return address;
    }

    /**
     * @return the branch
     */
    public List<BranchEntity> getBranch() {
        return branch;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(AddressEntity address) {
        this.address = address;
    }

    /**
     * @param branch the branch to set
     */
    public void setBranch(List<BranchEntity> branch) {
        this.branch = branch;
    }

    /**
     * @return the username
     */
    public String getUsername() {
        return username;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }

    /**
     * @param username the username to set
     */
    public void setUsername(String username) {
        this.username = username;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    
}